/**
 * 
 */

 const loadList = [
    // img
    'res/atlas/images.png',
    'res/atlas/images.atlas',
 ]


 export default class Preload extends Laya.Script {

    constructor() { super() }

    private progressText: Laya.Text // 加载进度文字

    onEnable(): void {
        this.progressText = this.owner.getChildByName('progress') as Laya.Text
        Laya.loader.load(loadList, Laya.Handler.create(this, this.onLoadComplete), Laya.Handler.create(this, this.onLoadProgress, null, false));
    }

    private onLoadComplete(success): void {
        Laya.Scene.open('scene/game.scene')
    }

    private onLoadProgress(p): void {
        let num = Math.ceil(p * 100)
        this.progressText.text = num + '%'
    }

 }